<?php
defined ( 'BASEPATH' ) or exit ( 'No direct script access allowed' );
class Messagerecord_model extends CI_Model {
	public function __construct() {
		parent::__construct ();
	}
	/*
	 *返回最新的通知
	 */
	public function find_recent_message(){
		$this->db->where('del=0');
		$this->db->order_by("id", "desc");
		$query = $this->db->get('t_messagerecord');
		return $query->row_array();
	}
	/*
	 * 根据分页返回通知列表
	 */
	public function find_by_page($page,$offset){
		$this->db->where('del=0');
		$this->db->limit($page, $offset);
		$this->db->order_by("id", "desc");
		$query = $this->db->get('t_messagerecord');
		return $query->result_array();
	}
	/*
	 * 根据通知ID得到通知信息
	 */
	public function load($id){//
		if (!$id){
			return array();
		}
		$this->db->where('id',$id);
		$query = $this->db->get('t_messagerecord');
		if ($row = $query->row_array()){
			return $row;
		}
		return array();
	}
}